home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 46
/
Amiga Format CD46 (1999-10-20)(Future Publishing)(GB)[!][issue 1999-12].iso
/
-serious-
/
misc
/
catmanged
/
scripts
/
strtocom.ged
< prev
Wrap
Text File
|
1999-09-06
|
2KB
|
81 lines
/*
** $VER: StrToCom 1.1 (30.08.99)
**
** Script author: Damir Arh
**
** (C)1999 Digital Amiga Dream
**
**
** FUNCTION:
** ARexx-script for GoldEd.
** Converts strings constants in a CT or CD file into comments.
** Inserts empty rows as indicators for translated strings.
**
** USAGE:
** StrToCom
**
** $HISTORY:
**
** 30.08.99 : 1.1 : Removed a syntax error
** 07.04.99 : 1.0 : First release
*/
OPTIONS RESULTS /* enable return codes */
if (LEFT(ADDRESS(), 6) ~= "GOLDED") then /* not started by GoldEd ? */
address 'GOLDED.1'
'LOCK CURRENT RELEASE=4' /* lock GUI, gain access */
if (RC ~= 0) then
exit
OPTIONS FAILAT 6 /* ignore warnings */
SIGNAL ON SYNTAX /* ensure clean exit */
/* ------------------------ INSERT YOUR CODE HERE: ------------------- */
'FIND STRING="#" FIRST QUIET' /* find beginning of the header */
'FIND STRING=";" NEXT QUIET' /* skip it */
mode = 'comment' /* looking for the const name */
do until (NumLines = CurrLine)
'QUERY CODE VAR=CurrChar'
'QUERY LINE VAR=CurrLine'
if mode = 'comment' then do /* found the const name? */
if (CurrChar ~= c2d(';')) then do
'DOWN'
'CR' /* insert empty line */
'UP'
mode = 'string' /* commenting strings */
end
end
else do
if (CurrChar ~= c2d(';')) then do /* not at the end of string */
'FIRST'
'TEXT T=";"' /* comment it */
'FIRST'
end
else do
mode = 'comment' /* looking for the next const name */
end
end
'DOWN'
'QUERY LINES VAR=NumLines' /* get the number of lines (it changes) */
end
/* ---------------------------- END OF YOUR CODE --------------------- */
'UNLOCK' /* VERY important: unlock GUI */
exit
SYNTAX:
SAY "Sorry, error line" SIGL ":" ERRORTEXT(RC) ":-("
'UNLOCK'
exit